package wqh.pojo;

import wqh.domain.*;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by devts on 2016/9/28.
 */
public class MonitorAlarm {

    private Integer monitor_id;
    private Integer alarm_origin_id;
    private Integer geo_level_1_id;
    private Integer geo_level_2_id;
    private Integer geo_level_3_id;
    private String geo;
    private Integer device_id;
    private String device_name;
    private Integer sensor_id;
    private String sensor_name;
    private String name;
    private String pos_x;
    private String pos_y;
    private String picture;
    private String ip;
    private String up_x;
    private String type;
    private Integer addr;
    private String dev_type;
    private Integer dev_addr;
    private String dev_status;
    private String alarm_time;
    private String phone;

    public MonitorAlarm()
    {

    }

    public MonitorAlarm(Monitor monitor, GeoBuilding geoBuilding1, GeoBuilding geoBuilding2, GeoBuilding geoBuilding3, Device device, Sensor sensor, AlarmInComming alarmInComming)
    {
        this.monitor_id = monitor.getId();
        this.alarm_origin_id = alarmInComming.getId();
        this.geo_level_1_id = geoBuilding1.getId();
        this.geo_level_2_id = geoBuilding2.getId();
        this.geo_level_3_id = geoBuilding3.getId();
        this.geo = geoBuilding1.getName() + " _ " + geoBuilding2.getName() + " _ " + geoBuilding3.getName();
        this.device_id = device.getId();
        this.device_name = device.getName();
        this.sensor_id = sensor.getId();
        this.sensor_name = sensor.getName();
        this.name = monitor.getName();
        this.pos_x = monitor.getPos_x();
        this.pos_y = monitor.getPos_y();
        this.picture = null;//geoBuilding3.getPicture();
        this.ip = IPConver.int2Ip(alarmInComming.getIp());
        this.up_x = alarmInComming.getUp_x();
        this.type = alarmInComming.getType();
        this.addr = alarmInComming.getAddr();
        this.dev_type = alarmInComming.getDev_type();
        this.dev_addr = alarmInComming.getDev_addr();
        this.dev_status = alarmInComming.getDev_status();
        this.alarm_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(Long.parseLong(String.valueOf(alarmInComming.getAlarm_time())) * 1000));
        this.phone = device.getPhone();
    }

    @Override
    public String toString() {
        return "MonitorAlarm{" +
                "monitor_id=" + monitor_id +
                ", alarm_origin_id=" + alarm_origin_id +
                ", geo_level_1_id=" + geo_level_1_id +
                ", geo_level_2_id=" + geo_level_2_id +
                ", geo_level_3_id=" + geo_level_3_id +
                ", geo='" + geo + '\'' +
                ", device_id=" + device_id +
                ", device_name='" + device_name + '\'' +
                ", sensor_id=" + sensor_id +
                ", sensor_name='" + sensor_name + '\'' +
                ", name='" + name + '\'' +
                ", pos_x='" + pos_x + '\'' +
                ", pos_y='" + pos_y + '\'' +
                ", picture='" + picture + '\'' +
                ", ip='" + ip + '\'' +
                ", up_x='" + up_x + '\'' +
                ", type='" + type + '\'' +
                ", addr=" + addr +
                ", dev_type='" + dev_type + '\'' +
                ", dev_addr=" + dev_addr +
                ", dev_status='" + dev_status + '\'' +
                ", alarm_time='" + alarm_time + '\'' +
                ", phone='" + phone + '\'' +
                '}';
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAlarm_time() {
        return alarm_time;
    }

    public void setAlarm_time(String alarm_time) {
        this.alarm_time = alarm_time;
    }

    public Integer getMonitor_id() {
        return monitor_id;
    }

    public void setMonitor_id(Integer monitor_id) {
        this.monitor_id = monitor_id;
    }

    public Integer getAlarm_origin_id() {
        return alarm_origin_id;
    }

    public void setAlarm_origin_id(Integer alarm_origin_id) {
        this.alarm_origin_id = alarm_origin_id;
    }

    public Integer getGeo_level_1_id() {
        return geo_level_1_id;
    }

    public void setGeo_level_1_id(Integer geo_level_1_id) {
        this.geo_level_1_id = geo_level_1_id;
    }

    public Integer getGeo_level_2_id() {
        return geo_level_2_id;
    }

    public void setGeo_level_2_id(Integer geo_level_2_id) {
        this.geo_level_2_id = geo_level_2_id;
    }

    public Integer getGeo_level_3_id() {
        return geo_level_3_id;
    }

    public void setGeo_level_3_id(Integer geo_level_3_id) {
        this.geo_level_3_id = geo_level_3_id;
    }

    public String getGeo() {
        return geo;
    }

    public void setGeo(String geo) {
        this.geo = geo;
    }

    public Integer getDevice_id() {
        return device_id;
    }

    public void setDevice_id(Integer device_id) {
        this.device_id = device_id;
    }

    public String getDevice_name() {
        return device_name;
    }

    public void setDevice_name(String device_name) {
        this.device_name = device_name;
    }

    public Integer getSensor_id() {
        return sensor_id;
    }

    public void setSensor_id(Integer sensor_id) {
        this.sensor_id = sensor_id;
    }

    public String getSensor_name() {
        return sensor_name;
    }

    public void setSensor_name(String sensor_name) {
        this.sensor_name = sensor_name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPos_x() {
        return pos_x;
    }

    public void setPos_x(String pos_x) {
        this.pos_x = pos_x;
    }

    public String getPos_y() {
        return pos_y;
    }

    public void setPos_y(String pos_y) {
        this.pos_y = pos_y;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getUp_x() {
        return up_x;
    }

    public void setUp_x(String up_x) {
        this.up_x = up_x;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getAddr() {
        return addr;
    }

    public void setAddr(Integer addr) {
        this.addr = addr;
    }

    public String getDev_type() {
        return dev_type;
    }

    public void setDev_type(String dev_type) {
        this.dev_type = dev_type;
    }

    public Integer getDev_addr() {
        return dev_addr;
    }

    public void setDev_addr(Integer dev_addr) {
        this.dev_addr = dev_addr;
    }

    public String getDev_status() {
        return dev_status;
    }

    public void setDev_status(String dev_status) {
        this.dev_status = dev_status;
    }
}
